<?php
/**
 * Create By: PhpStorm
 * User: niechenguang
 * File: Circle.php
 * Date: 2017/1/2
 * Time: 23:13
 */
namespace app\home\model\dao;

use think\Log;
use think\Model;
use think\Db;

class SigninConfig extends Model
{
    protected $table = 'signin_config';

    protected $pk = 'id';

    /**
     * 签到
     *
     */
    public function addSigninConfig($arrInput)
    {
        unset($arrInput[$this->pk]);

        $this->data($arrInput);
        $this->save();
        return $this->data[$this->pk];
    }

    /**
     * 获取某人某段时间签到列表
     *
     */
    public function getSigninConfig()
    {
        $ret = Db::table($this->table)->order(' create_time desc ')->select();
        if (false === $ret) {
            Log::error(__METHOD__ . ' get signin config fail. ');
            return false;
        }
        return $ret[0];
    }

}
